package com.zg.assistant.web;

import com.zg.assistant.req.ImageRecognitionReq;
import com.zg.assistant.service.ImageRecognitionService;
import com.zg.common.core.R;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
* @author zg
*/
@RestController
@RequiredArgsConstructor
public class ImageRecognitionController {

	private final ImageRecognitionService imageRecognitionService;

	/**
	 * 图片识别
	 * @return 图片识别结果
	 */
	@PostMapping("/image/recognition")
	public R<Map<String, Object>> imageRecognition(@RequestBody @Validated ImageRecognitionReq imageRecognitionReq) {
		Map<String, Object> imageRecognition = imageRecognitionService.imageRecognition(imageRecognitionReq);
		return R.success(imageRecognition);
	}

}
